package com.njitweb.controller;

import com.njitweb.pojo.User;
import com.njitweb.service.UserService;
import com.njitweb.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
public class UserController {

    @Autowired
    private UserService userService;

    @PostMapping("/login")
    public Result login(@RequestBody User user) {
        Map<String, Object> map = userService.login(user);
        return Result.success(map);
    }

    @PostMapping("/register")
    public Result register(@RequestBody User user) {
        Map<String, Object> map = userService.login(user);
        return new Result();
    }
}
